const express = require("express");
const app = express();
const bodyParser = require("body-parser");
//暴露文件
app.use(express.static("public"));
app.use(bodyParser.urlencoded({extended:true}));

app.get("/index",(req,res)=>{
    console.log(req.query);
    res.sendFile(__dirname + "/public/html/index.html");
})

// const pp = {};
app.post("/denglu",(req,res)=>{
    console.log(req.body);
    // pp = req.body;
    res.send("返回 post请求1");
})

app.post("/zhuce",(req,res)=>{
    console.log(req.body);
    // pp = req.body;
    res.send("返回 post请求2");
})

app.listen(3000,err=>{
    if(!err) console.log("服务器启动成功！");
    else console.log(err);
})